package com.example.star.api_service;

import com.example.star.entity.BuyNow;
import com.example.star.entity.ShoppingCart;

import java.util.List;

import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Path;
import retrofit2.http.Query;

public interface ApiBuyNow {
    @POST("buy_nows")
    Call<BuyNow> saveBuyNow(@Body BuyNow buyNow);

    // 根据用户名查询购物车数据
    @GET("buy_nows/items-by-user")
    Call<List<BuyNow>> getBuyNowsByuserName(@Query("userName") String userName);

    @FormUrlEncoded
    @POST("buy_nows/submit_evaluation/{id}")
    Call<String> submitEvaluation(@Path("id") int id, @Field("rating") float rating, @Field("comment") String comment);

    @DELETE("buy_nows/order/{id}")
    Call<Void> deleteOrder(@Path("id") int id);

    @POST("buy_nows/updateOrderStatus")
    Call<BuyNow> updateOrderStatus(@Query("id") int id, @Query("orderStatus") String orderStatus);
    // 添加根据用户名和订单状态查询的方法
    @GET("buy_nows/items-by-user-and-status")
    Call<List<BuyNow>> getBuyNowsByuserNameAndOrderStatus(@Query("userName") String userName, @Query("orderStatus") String orderStatus);

    @DELETE("buy_nows/{id}")
    Call<Void> deleteBuyNowById(@Path("id") int id);

    @DELETE("buy_nows/delete_userId")
    Call<Void> deleteBuyNowByuserName(@Query("userName") String userName, @Query("title") String title);

    @GET("buy_nows/check")
    Call<Boolean> checkBuyNow(@Query("userName") String userName, @Query("title") String title);

    @GET("buy_nows/items-by-orderStatus")
    Call<List<BuyNow>> getBuyNowByOrderStatus(@Query("orderStatus") String orderStatus);

    @GET("buy_nows")
    Call<List<BuyNow>> getBuyNows();



}
